{include file="public/public"}

<div class="layui-tab layui-tab-brief" lay-filter="demoTitle">
    <div class="layui-body layui-tab-content site-demo site-demo-body">
        <div class="layui-tab-item layui-show">
            <div class="layui-main">
                <fieldset class="layui-elem-field layui-field-title" style="margin-top: 50px;">
                </fieldset>
                <span class="layui-breadcrumb">
	                   	<a href="__APP__/{$menuConfigArry['functionMod']}/{$menuConfigArry['menuLabel']}">{$menuConfigArry['pmenuName']}</a>
                    	<a><cite>{$menuConfigArry['menuName']}</cite></a>
	                </span>
                <hr>

                <div class="layui-tab " style="margin-top: 20px;">
                    <?php
                    if($childMenuArry){
                    ?>
                    <ul class="layui-tab-title">
                        <?php
                        foreach($childMenuArry as $cm){
                            if($method==$cm['menuLabel']){
                    ?>
                        <li  class="layui-this" ><a href="__APP__/{$cm['functionMod']}/{$cm['pmenuLabel']}?m={$cm['menuLabel']}">{$cm['menuName']}</a></li>
                        <?php
                            }else{
                            ?>
                        <li ><a href="__APP__/{$cm['functionMod']}/{$cm['pmenuLabel']}?m={$cm['menuLabel']}">{$cm['menuName']}</a></li>
                        <?php
                            }
                        }
                    ?>
                    </ul>
                    <?php
                    }
                   ?>

                    <div class="content_3_ss clear">
                        <ul>
                            <li><span class="ctt_wd left">姓名查找：</span>
                                <input name="text2" type="text" id='souname'  class="layui-input" />
                            </li>
                            <li class="ss_cx"><a href="#" onClick="subsou()">查询</a></li>
                            <li class="ss_cx"><a href="__APP__/admin/operationlog?type=user">操作日志</a></li>
                        </ul>
                    </div>
                      <table class="layui-table" lay-skin="line" >
                       <thead >
                        <tr>
                            <td width="106">选择</td>
                            <td width="103">编号</td>
                            <td width="125" >账号</td>
                            <td width="215" >姓名</td>
                            <td width="215" >权限</td>
                            <td width="137">操作</td>
                        </tr>
                        </thead>
                        <tbody>
                        <?
     if($adminArr){
      foreach($adminArr as $val){
       $tmp = addslashes(json_encode($val));
		if($val[id]){
	?>
                        <tr>
                            <?php if($val[level]!=0){?>
                            <td><input  type="checkbox" name="adminbox" id="adminbox"  value="{$val[id]}"></td>
                            <?php }else{?>
                            <td>&nbsp;</td>
                            <?php }?>
                            <td>{$val[id]}</td>
                            <td>{$val[username]}</td>
                            <td >{$val[uname]}</td>
                            <td >{$val[rolename]}</td>
                            <?php if($val[level]!=0){?>
                            <td><a href="#" class="layui-btn layui-btn-sm"onclick='edit("{$tmp}")'>修改</a></td>
                            <?php }?>
                        </tr>
                        <?php
     	}
		}
	}?>
                        </tbody>
                    </table>
                    <div class="content_1234">
                        <div class="content_glcz">管理操作：全选
                            <input type="checkbox" name="checkbox" value="checkbox" onClick="checkallstu(this)" >
                            <input name="submit" type="submit" value="删除"  onclick="delall()" class="layui-btn layui-btn-sm layui-btn-warm"/>
                            <input name="submit3" type="submit" value="添加"  onclick="add()" class="layui-btn layui-btn-sm"/>
                        </div>
                        <div class="layui-box layui-laypage layui-laypage-default">{$page}</div>
                    </div>

                    <form action="__APP__/system/addadmin" method="post" enctype="multipart/form-data">
                        <div id="show" style="DISPLAY:none" class="show">
                            <table width="500px" border="0" align="center"  cellpadding="0" bgcolor="#FFFFFF" style="text-align:center; border:1px solid #e4e4e4;">
                               <thead >
                                <tr class="ctt_gr">
                                    <td colspan="2">用户信息</td>
                                    <input type="hidden" id="id" name="id">
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="ctt_gr">
                                    <td width="276" align="right">登&nbsp;陆&nbsp;名：</td>
                                    <td width="316" align="left"><input class="textField_hp1" size="15" type="text" id="username" name="username"/></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td align="right">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
                                    <td align="left"><input class="textField_hp1" size="15" type="password" id="password" name="password" /></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td align="right">姓&nbsp;&nbsp;&nbsp;&nbsp;名：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="uname" name="uname" /></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td align="right">部&nbsp;&nbsp;&nbsp;&nbsp;门：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="department" name="department"/></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td align="right">职&nbsp;&nbsp;&nbsp;&nbsp;务：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="post"  name="post" /></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td align="right">手&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="phone" name="phone"/></td>
                                </tr><tr class="ctt_gr">
                                    <td align="right">座&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="landline" name="landline" /></td>
                                </tr><tr class="ctt_gr">
                                    <td align="right">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="email" name="email" /></td>
                                </tr><tr class="ctt_gr">
                                    <td align="right">其&nbsp;&nbsp;&nbsp;&nbsp;他：</td>
                                    <td align="left"><input class="textField_hp1" size="15" id="other" name="other"/></td>
                                </tr>

                                <tr class="ctt_gr">
                                    <td align="right">权限级别：</td>
                                    <td align="left"><label>
                                        <select name="level" id="level"  >
                                            <?
        		if($permissionArr){
        			foreach($permissionArr as $val){
	        ?>
                                            <option value="{$val['id']}">{$val['rolename']}</option>
                                            <?
	        		}
				}
        	?>
                                        </select>
                                    </label></td>
                                </tr>
                                <tr class="ctt_gr">
                                    <td colspan="2" align="center"><input name="submit22" type="submit" value="确定" border="0" method="post" class="layui-btn"/>
                                        <input name="submit22" type="button" value="关闭" border="0" onclick="document.getElementById
	('show').style.display='none'" class="layui-btn layui-btn-warm"/>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </form>
                </div>


                </div>
            </div>
        </div>
    </div>


    <script language="javascript">
function edit(val){
    var json=JSON.parse(val);
//    alert(val);
	$("#username").val(json.username);

	$("#uname").val(json.uname);
	$("#id").val(json.id);
	$("#level").val(json.level);
    $("#department").val(json.department);
    $("#post").val(json.post);
    $("#phone").val(json.phone);
    $("#landline").val(json.landline);
    $("#email").val(json.email);
    $("#other").val(json.other);

	$('#show').show();
}

function subsou(){
	var souname = $("#souname").val();
	window.location.href='__APP__/system/index?name='+souname;
}
function checkallstu(o) {
	if(o.checked){
		$("input[name='adminbox']").attr("checked",true);
	}else{
		$("input[name='adminbox']").attr("checked",false);
	}
}
function delall(){
    var arr="";
    $("input[name=adminbox]:checked").each(function(){
    	arr+=$(this).val()+",";
    })
    if(arr==""){
    	alert('请选择要删除的记录');
		return false; 
    }
    if (!confirm("您确定要删除吗？")){
        return false;
    }
    	
    $.post("__APP__/system/delalladmin",{
    	arr : arr
	}, function(data) {
		if(data.msg=="1"){
			alert("删除成功");
			location.reload();
		}else{
			alert("删除失败");
		}
	},"json");
}
    function add(){
        $("#username").val("");
        $("#password").val("");
        $("#show").show();
    }

function checkLeave(){
alert("===onbeforeunload===");

}

</script>

